package com.kly.user.controller;

import com.fqgj.common.api.Response;
import com.kly.user.chatterService.ModelServiceImpl;
import com.kly.user.dto.chatter.request.QueryNewModelReq;
import com.kly.user.dto.chatter.response.NewModelsDto;
import com.kly.user.controller.req.NewMatchListReq;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * model相关接口类
 * @author linqu
 */
@RestController
@RequestMapping("/api/user")
public class ModelController {

    @Resource
    private ModelServiceImpl modelServiceImpl;


    /**
     * 获取新关系列表
     */
    @ResponseBody
    @RequestMapping(value = "/match/newMatchList")
    public Response<NewModelsDto> newMatchList(@Valid @RequestBody NewMatchListReq newMatchListReq, BindingResult results) {
        if (results.hasErrors()) {
            return Response.error();
        }
        return modelServiceImpl.queryNewModelList(
                QueryNewModelReq.builder().chatterUserCode(newMatchListReq.getChatterUserCode()).build());

    }

}
